import 'package:package_info_plus/package_info_plus.dart';

class PackageInfoUtils {
  PackageInfoUtils._();

  static late PackageInfo _packageInfo;

  static Future<void> init() async {
    _packageInfo = await PackageInfo.fromPlatform();
  }

  ///获取当前应用名称
  static String getAppName() {
    return _packageInfo.appName;
  }

  ///获取当前应用包名
  static String getPackageName() {
    return _packageInfo.packageName;
  }

  ///获取当前应用版本号
  static String getVersion() {
    return _packageInfo.version;
  }

  ///获取当前应用构建版本号
  static String getBuildNumber() {
    return _packageInfo.buildNumber;
  }
}
